package com.graduation.vaccine.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.graduation.vaccine.dto.AppointmentDTO;
import com.graduation.vaccine.dto.SysAppointmentDTO;
import com.graduation.vaccine.pojo.Appointment;
import com.graduation.vaccine.vo.AppointmentVo;
import com.graduation.vaccine.vo.DataListInfo;
import com.graduation.vaccine.vo.DataListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ZhaoJunYao
 * @since 2022-04-22
 */
@Mapper
public interface AppointmentMapper extends BaseMapper<Appointment> {

    /**
     * 查询得到用户所有的订单
     * @param phone
     * @return
     */
    List<AppointmentDTO> getListByPhone(String phone);

    /**
     * 增加订单
     * @param appointmentVo
     * @return
     */
    Integer addOne(AppointmentVo appointmentVo);

    /**
     * 全部列表
     * @return
     */
    List<Appointment> getAll();

    /**
     *未预约过才能预约(根据idCardNumber在appointment表中找是否有在预约状态的productId)
     * @param idCardNumber
     * @param productionId
     * @return
     */
    List<Appointment> getListByIdCardNumberAndProductId(String idCardNumber, Integer productionId);

    /**
     * 不可一天预约两个以上的疫苗
     * @param idCardNumber
     * @param date
     * @return
     */
    List<Appointment> getListByIdCardNumberAndDate(String idCardNumber, String date);

    /**
     * 获取可预约时间表
     * @param dataListVo
     * @return
     */
    List<DataListInfo> getDataList(DataListVo dataListVo);

    List<SysAppointmentDTO> getListByCode(String departmentCode);

    Integer updateStatus(@Param("id") Integer id, @Param("status") Integer status, @Param("time") Date time);

    Integer getStatusById(Integer id);
}
